home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / mc302emb.zip / WALK.C < prev   
C/C++ Source or Header  |  1994-03-18  |  400b  |  27 lines

  1. /*
  2.  * Program to walk a bit through an I/O port
  3.  */
  4. main()
  5. {
  6.     int i;
  7.  
  8. loop:
  9.     outp1(0x01);                /* Initialize to only bit0 */
  10.  
  11.     for(i=0; i < 8; ++i) {        /* Perform 8 steps */
  12.         wait(50);                /* Wait a bit */
  13.         outp1(inp1() << 1);    }    /* Move bit over */
  14.  
  15.     goto loop;                    /* Infinite loop */
  16. }
  17.  
  18. /*
  19.  * Wait a short delay
  20.  */
  21. wait(delay)
  22.     unsigned delay;
  23. {
  24.     while(delay)
  25.         --delay;
  26. }
  27.